home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / Printing.h < prev    next >
Text File  |  1991-05-01  |  10KB  |  329 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 9:40 PM
  4.     Printing.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1989
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTING__
  15. #define __PRINTING__
  16.  
  17. #ifndef __GEOMETRY__
  18. #include <Geometry.h>
  19. #endif
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24.  
  25. #ifndef __DIALOGS__
  26. #include <Dialogs.h>
  27. #endif
  28.  
  29.  
  30. enum {
  31.  
  32.     iPFMaxPgs = 128,
  33.     iPrPgFract = 120,               /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  34.     iPrPgFst = 1,                   /*Page range constants*/
  35.     iPrPgMax = 9999,
  36.     iPrRelease = 3,                 /*Current version number of the code.*/
  37.     iPrSavPFil = -1,
  38.     iPrAbort = 0x0080,
  39.     iPrDevCtl = 7,                  /*The PrDevCtl Proc's ctl number*/
  40.     lPrReset = 0x00010000,          /*The PrDevCtl Proc's CParam for reset*/
  41.     lPrLineFeed = 0x00030000,
  42.     lPrLFStd = 0x0003FFFF,          /*The PrDevCtl Proc's CParam for std paper advance*/
  43.     lPrLFSixth = 0x0003FFFF,
  44.     lPrPageEnd = 0x00020000,        /*The PrDevCtl Proc's CParam for end page*/
  45.     lPrDocOpen = 0x00010000,
  46.     lPrPageOpen = 0x00040000,
  47.     lPrPageClose = 0x00020000,
  48.     lPrDocClose = 0x00050000,
  49.     iFMgrCtl = 8,                   /*The FMgr's Tail-hook Proc's ctl number*/
  50.     iMemFullErr = -108,
  51.     iIOAbort = -27
  52. };
  53. enum {
  54.     pPrGlobals = 0x00000944,        /*The PrVars lo mem area:*/
  55.     bDraftLoop = 0,
  56.     bSpoolLoop = 1,
  57.     bUser1Loop = 2,
  58.     bUser2Loop = 3,
  59.     iPrBitsCtl = 4,
  60.     lScreenBits = 0,
  61.     lPaintBits = 1,
  62.     lHiScreenBits = 0x00000002,     /*The Bitmap Print Proc's Screen Bitmap param*/
  63.     lHiPaintBits = 0x00000003,      /*The Bitmap Print Proc's Paint [sq pix] param*/
  64.     iPrIOCtl = 5,
  65.     iPrEvtCtl = 6,                  /*The PrEvent Proc's ctl number*/
  66.     lPrEvtAll = 0x0002FFFD,         /*The PrEvent Proc's CParam for the entire screen*/
  67.     lPrEvtTop = 0x0001FFFD,         /*The PrEvent Proc's CParam for the top folder*/
  68.  
  69. #define sPrDrvr ".Print"
  70.  
  71.     iPrDrvrRef = -3,
  72.     getRslDataOp = 4,
  73.     setRslOp = 5,
  74.     draftBitsOp = 6,
  75.     noDraftBitsOp = 7,
  76.     getRotnOp = 8
  77. };
  78. enum {
  79.     NoSuchRsl = 1,
  80.     RgType1 = 1
  81. };
  82.  
  83. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  84. typedef unsigned char TFeed;
  85.  
  86. enum {scanTB,scanBT,scanLR,scanRL};
  87. typedef unsigned char TScan;
  88.  
  89.  
  90. typedef Rect *TPRect;
  91. typedef pascal void (*PrIdleProcPtr)(void);
  92. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  93.  
  94. struct TPrPort {
  95.     GrafPort gPort;                 /*The Printer's graf port.*/
  96.     QDProcs gProcs;                 /*..and its procs*/
  97.     long lGParam1;                  /*16 bytes for private parameter storage.*/
  98.     long lGParam2;
  99.     long lGParam3;
  100.     long lGParam4;
  101.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  102.     Boolean fOurBits;               /*Whether the BitMap allocation was done by us.*/
  103. };
  104.  
  105. typedef TPrPort *TPPrPort;
  106.  
  107. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  108.   This is the "PrPeek" record. */
  109. struct TPrInfo {
  110.     short iDev;                     /*Font mgr/QuickDraw device code*/
  111.     short iVRes;                    /*Resolution of device, in device coordinates*/
  112.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  113.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  114. };
  115.  
  116. typedef TPrInfo *TPPrInfo;
  117.  
  118. /* Print Info Record: The parameters needed for page composition. */
  119. struct TPrStl {
  120.     short wDev;
  121.     short iPageV;
  122.     short iPageH;
  123.     char bPort;
  124.     TFeed feed;
  125. };
  126.  
  127. typedef struct TPrStl TPrStl;
  128. typedef TPrStl *TPPrStl;
  129.  
  130. struct TPrXInfo {
  131.     short iRowBytes;
  132.     short iBandV;
  133.     short iBandH;
  134.     short iDevBytes;
  135.     short iBands;
  136.     char bPatScale;
  137.     char bUlThick;
  138.     char bUlOffset;
  139.     char bUlShadow;
  140.     TScan scan;
  141.     char bXInfoX;
  142. };
  143.  
  144. typedef struct TPrXInfo TPrXInfo;
  145. typedef TPrXInfo *TPPrXInfo;
  146.  
  147. struct TPrJob {
  148.     short iFstPage;                 /*Page Range.*/
  149.     short iLstPage;
  150.     short iCopies;                  /*No. copies.*/
  151.     char bJDocLoop;                 /*The Doc style: Draft, Spool, .., and ..*/
  152.     Boolean fFromUsr;               /*Printing from an User's App (not PrApp) flag*/
  153.     PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  154.     StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  155.     short iFileVol;                 /*Spool File vol, set to 0 initially*/
  156.     char bFileVers;                 /*Spool File version, set to 0 initially*/
  157.     char bJobX;                     /*An eXtra byte.*/
  158. };
  159.  
  160. typedef struct TPrJob TPrJob;
  161. typedef TPrJob *TPPrJob;
  162.  
  163. /* Print Job: Print "form" for a single print request. */
  164. struct TPrint {
  165.     short iPrVersion;               /*(2) Printing software version*/
  166.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  167.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  168.     TPrStl prStl;                   /*(8)  This print request's style.*/
  169.     TPrInfo prInfoPT;               /*(14)  Print Time Imaging metrics*/
  170.     TPrXInfo prXInfo;               /*(16)  Print-time (expanded) Print info record.*/
  171.     TPrJob prJob;                   /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  172.     short printX[19];               /*Spare to fill to 120 bytes!*/
  173. };
  174.  
  175. typedef TPrint *TPPrint, **THPrint;
  176.  
  177. /* The universal 120 byte printing record */
  178. struct TPrStatus {
  179.     short iTotPages;                /*Total pages in Print File.*/
  180.     short iCurPage;                 /*Current page number*/
  181.     short iTotCopies;               /*Total copies requested*/
  182.     short iCurCopy;                 /*Current copy number*/
  183.     short iTotBands;                /*Total bands per page.*/
  184.     short iCurBand;                 /*Current band number*/
  185.     Boolean fPgDirty;               /*True if current page has been written to.*/
  186.     Boolean fImaging;               /*Set while in band's DrawPic call.*/
  187.     THPrint hPrint;                 /*Handle to the active Printer record*/
  188.     TPPrPort pPrPort;               /*Ptr to the active PrPort*/
  189.     PicHandle hPic;                 /*Handle to the active Picture*/
  190. };
  191.  
  192. typedef struct TPrStatus TPrStatus;
  193. typedef TPrStatus *TPPrStatus;
  194.  
  195. /* Print Status: Print information during printing. */
  196. struct TPfPgDir {
  197.     short iPages;
  198.     long iPgPos[129];               /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  199. };
  200.  
  201. typedef struct TPfPgDir TPfPgDir;
  202. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  203.  
  204. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  205. struct TPrDlg {
  206.     DialogRecord Dlg;               /*The Dialog window*/
  207.     ModalFilterProcPtr pFltrProc;   /*The Filter Proc.*/
  208.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  209.     THPrint hPrintUsr;              /*The user's print record.*/
  210.     Boolean fDoIt;
  211.     Boolean fDone;
  212.     long lUser1;                    /*Four longs for user's to hang global data.*/
  213.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  214.     long lUser3;
  215.     long lUser4;
  216. };
  217.  
  218. typedef TPrDlg *TPPrDlg;
  219.  
  220.  
  221. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  222.  
  223. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  224. Print Dialog: The Dialog Stream object. */
  225.  
  226.  
  227.  
  228. struct TGnlData {
  229.     short iOpCode;
  230.     short iError;
  231.     long lReserved;                 /*more fields here depending on call*/
  232. };
  233.  
  234. typedef struct TGnlData TGnlData;
  235.  
  236. struct TRslRg {
  237.     short iMin;
  238.     short iMax;
  239. };
  240.  
  241. typedef struct TRslRg TRslRg;
  242.  
  243. struct TRslRec {
  244.     short iXRsl;
  245.     short iYRsl;
  246. };
  247.  
  248. typedef struct TRslRec TRslRec;
  249.  
  250. struct TGetRslBlk {
  251.     short iOpCode;
  252.     short iError;
  253.     long lReserved;
  254.     short iRgType;
  255.     TRslRg xRslRg;
  256.     TRslRg yRslRg;
  257.     short iRslRecCnt;
  258.     TRslRec rgRslRec[27];
  259. };
  260.  
  261. typedef struct TGetRslBlk TGetRslBlk;
  262.  
  263. struct TSetRslBlk {
  264.     short iOpCode;
  265.     short iError;
  266.     long lReserved;
  267.     THPrint hPrint;
  268.     short iXRsl;
  269.     short iYRsl;
  270. };
  271.  
  272. typedef struct TSetRslBlk TSetRslBlk;
  273.  
  274. struct TDftBitsBlk {
  275.     short iOpCode;
  276.     short iError;
  277.     long lReserved;
  278.     THPrint hPrint;
  279. };
  280.  
  281. typedef struct TDftBitsBlk TDftBitsBlk;
  282.  
  283. struct TGetRotnBlk {
  284.     short iOpCode;
  285.     short iError;
  286.     long lReserved;
  287.     THPrint hPrint;
  288.     Boolean fLandscape;
  289.     char bXtra;
  290. };
  291.  
  292. typedef struct TGetRotnBlk TGetRotnBlk;
  293.  
  294.  
  295. #ifdef __cplusplus
  296. extern "C" {
  297. #endif
  298. pascal void PrPurge(void); 
  299. pascal void PrNoPurge(void); 
  300. pascal void PrOpen(void); 
  301. pascal void PrClose(void); 
  302. pascal void PrintDefault(THPrint hPrint); 
  303. pascal Boolean PrValidate(THPrint hPrint); 
  304. pascal Boolean PrStlDialog(THPrint hPrint); 
  305. pascal Boolean PrJobDialog(THPrint hPrint); 
  306. pascal TPPrDlg PrStlInit(THPrint hPrint); 
  307. pascal TPPrDlg PrJobInit(THPrint hPrint); 
  308. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst); 
  309. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit); 
  310. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf); 
  311. pascal void PrCloseDoc(TPPrPort pPrPort); 
  312. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame); 
  313. pascal void PrClosePage(TPPrPort pPrPort); 
  314. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  315.     TPrStatus& prStatus); 
  316. pascal short PrError(void); 
  317. pascal void PrSetError(short iErr); 
  318. pascal void PrGeneral(Ptr pData); 
  319. pascal void PrDrvrOpen(void); 
  320. pascal void PrDrvrClose(void); 
  321. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3); 
  322. pascal Handle PrDrvrDCE(void); 
  323. pascal short PrDrvrVers(void); 
  324. #ifdef __cplusplus
  325. }
  326. #endif
  327.  
  328. #endif
  329.